package o;

import android.content.Context;
import com.huawei.appgallery.foundation.store.bean.detail.DetailResponse;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse.TabInfo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class drm {
    private List<TabInfo> ˊ = new ArrayList();
    private transient Map<String, dre> ˋ = new HashMap();
    private Context ˏ;

    public drm(Context context) {
        this.ˏ = context.getApplicationContext();
    }

    public static boolean ˎ(drm o_drm, b bVar) {
        cfv o_cfv = (cfv) bVar.ˊ;
        DetailResponse detailResponse = (DetailResponse) bVar.ˋ;
        Collection ˎ = detailResponse.ˎ();
        if (CollectCheck.isEmpty(ˎ)) {
            Logger.ˋ("CategoryDataProvider", "response has no currentTabDetail, tabList is empty");
            return false;
        }
        o_drm.ˊ.clear();
        for (int i = 0; i < ˎ.size(); i++) {
            ((TabInfo) ˎ.get(i)).ˋ(i);
        }
        o_drm.ˊ.addAll(ˎ);
        cia o_cia = new cia(o_drm.ˏ);
        new eei().ॱ(o_cia, o_cfv, detailResponse, true);
        dre o_dre = new dre();
        o_dre.ˏ(o_cia);
        o_dre.ˎ(detailResponse.ॱˋ());
        o_dre.ˋ(detailResponse.ˋ());
        TabInfo ॱ = o_drm.ॱ();
        if (ॱ != null) {
            o_drm.ˋ.put(ॱ.ʼ(), o_dre);
        }
        return true;
    }

    public void ˎ(List<TabInfo> list) {
        this.ˊ = list;
    }

    public TabInfo ॱ() {
        TabInfo tabInfo = null;
        if (CollectCheck.isEmpty(this.ˊ)) {
            return null;
        }
        TabInfo tabInfo2;
        for (TabInfo tabInfo22 : this.ˊ) {
            if (!"1".equals(tabInfo22.ʻ())) {
                tabInfo22 = tabInfo;
            }
            tabInfo = tabInfo22;
        }
        if (tabInfo == null) {
            tabInfo22 = (TabInfo) this.ˊ.get(0);
        } else {
            tabInfo22 = tabInfo;
        }
        return tabInfo22;
    }

    public dre ˋ(String str) {
        return (dre) this.ˋ.get(str);
    }
}
